#ifndef TIPSWIDGET_H
#define TIPSWIDGET_H

#include <QWidget>

enum DIRECTION
{
    D_UP,    // 上
    D_DOWN,  // 下
    D_LEFT,  // 左
    D_RIGHT, // 右
};

#define MARGIN              5       // 边距
#define TRIANGLE_LENGTH     10      // 三角指示标记的长度

class TipsWidget : public QWidget
{
    Q_OBJECT
public:
    explicit TipsWidget(QString tips,
                        QWidget *sender = nullptr,
                        DIRECTION dirction = D_DOWN,
                        QWidget *parent = nullptr);

    void        initPara();
    void        changePos();
    void        paintEvent(QPaintEvent *event);
    bool        eventFilter(QObject *obj, QEvent *event);

    void        setText(QString tips);
    void        setDirection(DIRECTION direction);
    void        setSize(int width, int height);
    void        setRadius(int radius);
    void        setTextColor(QColor color);
    void        setBgColor(QColor color);
    void        setFont(QFont font);

private:
    QString     _tips;
    QWidget *   _sender;
    DIRECTION   _direction;
    int         _width;
    int         _height;
    int         _radius;
    QColor      _textColor;
    QColor      _bgColor;
    QFont       _font;
};

#endif // TIPSWIDGET_H
